﻿
<p><a href="<?php echo $this->url(array('controller' => 'index', 'action' => 'add')); ?>">Добавить новый продукт.</a></p>

<table border="1px" id='product_table'>
    <tr>
        <th>model</th>
        <th>description</th>
        <th>quantity </th>
        <th>redister_date</th>
        <th>price</th>
        <th>photo</th>
        <th>actions</th>
    </tr>
    <?php foreach($this->products as $product) : ?>
        <tr>
            <td><?php echo $this->escape($product->model) ?></td>
            <td><?php echo $this->escape($product->description) ?></td>
            <td><?php echo $this->escape($product->quantity) ?></td>
            <td><?php echo $this->escape($product->register_date) ?></td>
            <td><?php echo $this->escape($product->price) ?></td>
            <td><img src="<?php echo $this->baseUrl()."/images/products/".$this->escape($product->photo);?>" /></td>

            <td>
                <a name='' id='product_edit_archor' href="<?php echo $this->url(array('controller' => 'index', 'action' => 'edit', 'id' => $product->product_id)) ?>">Редактировать</a>
                <a id='product_delete_archor' href="<?php echo $this->url(array('controller' => 'index', 'action' => 'delete', 'id' => $product->product_id)) ?>">Удалить</a>
            </td>
        </tr>
    <?php endforeach; ?>
</table>
<br clear="all"/>
<div id='category_in_products'>
 <?php echo $this->partial('category/index.phtml',array('categoriesFromProduct'=>$this->categories));
 ?>
</div>
<script language='javascript'>
	$(function(){
		$('#product_edit_archor').click(function(){
			$.ajax({
				 type: "POST",
				url: "ajax/load/post.php",
				data: ({a : aaa, b : bbb}),
				success: function(data){$("#example_j span").text("Выполнено! " + data);}
			});
		});
	});

</script>